#include "user_led.h"
#include "driver/gpio.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "stdio.h"

#define GPIO_OUTPUT_IO_0     23
#define GPIO_OUTPUT_IO_1     25
#define GPIO_OUTPUT_PIN_SEL  ((1ULL<<GPIO_OUTPUT_IO_0) | (1ULL<<GPIO_OUTPUT_IO_1))

void user_led_init(void)
{
    //zero-initialize the config structure.
    gpio_config_t io_conf = {};
    //disable interrupt
    io_conf.intr_type = GPIO_INTR_DISABLE;
    //set as output mode
    io_conf.mode = GPIO_MODE_OUTPUT;
    //bit mask of the pins that you want to set,e.g.GPIO18/19
    io_conf.pin_bit_mask = GPIO_OUTPUT_PIN_SEL;
    //disable pull-down mode
    io_conf.pull_down_en = 0;
    //disable pull-up mode
    io_conf.pull_up_en = 1;
    //configure GPIO with the given settings
    gpio_config(&io_conf);

    gpio_set_level(GPIO_OUTPUT_IO_0, 0);
    gpio_set_level(GPIO_OUTPUT_IO_1, 1);
}

void user_led_task(void *arg)
{
    user_led_init();
    printf("%s %d start\r\n",__func__, __LINE__);
    while (1) {

    	gpio_set_level(GPIO_OUTPUT_IO_0, 1);
        vTaskDelay(100);
    	gpio_set_level(GPIO_OUTPUT_IO_0, 0);
        vTaskDelay(100);
    }
}

